#ifndef SORTED_INDEXED_ARRAY
#define SORTED_INDEXED_ARRAY

/* Sorted Indexed Array
*************************************************************************************
*
*   Does not resize
*
*************************************************************************************
*
*   Credits
*
*		Richard Rios
*		Aaron Solomon
*
*************************************************************************************/

#include <iostream>
using namespace std;

template <typename TYPE>
class SortedIndexedArray {
	/*************************************************************************************
	*
	*	Fields
	*/
	private:
		TYPE* values;

		int count;

		const int(*comparator)(void*, void*);

	public:
		static const int EXCEPTION_OVERFLOW			= 1; //thrown when writing too many elements to the array
		static const int EXCEPTION_OUT_OF_BOUNDS	= 2; //thrown when trying to read an element outside of the bounds of the array
	/*
	*************************************************************************************
	*
	*	Constructors
	*/
		SortedIndexedArray(const int max, const int(*)(void*, void*));
		/*
		*
		*   Description
		*   -----------------------
		*
		*       Creates and initializes a Sorted Indexed Array
		*
		*   Takes
		*   -----------------------
		*
		*       nothing
		*
		*   Returns
		*   -----------------------
		*
		*       initialized SortedIndexedArray
		*
		*/
	/*
	*************************************************************************************
	*
	*	Destructor
	*/
		~SortedIndexedArray();
		/*
		*
		*   Description
		*   -----------------------
		*
		*       Cleans values
		*
		*   Takes
		*   -----------------------
		*
		*       nothing
		*
		*   Returns
		*   -----------------------
		*
		*       nothing
		*
		*/
	/*
	*************************************************************************************
	*
	*	Operators
	*
	*		Setters
	*/
			/* none */
	/*
	**************************************************************************************
	*
	*		Getters
	*/
			TYPE get(int index);
			/*
			*
			*   Description
			*   -----------------------
			*
			*       Reads an element directly out of the array
			*			-	arr[index] == get(index)
			*
			*   Takes
			*   -----------------------
			*
			*       int index
			*
			*   Returns
			*   -----------------------
			*
			*       TYPE
			*
			*/

			int getCount(); //gets current number of elements in the array
	/*
	*************************************************************************************
	*
	*	Methods
	*/
		void insert(TYPE value);
		/*
		*
		*   Description
		*   -----------------------
		*
		*       Inserts an element into the indexed array
		*			-	arr.insert(value)
		*
		*   Takes
		*   -----------------------
		*
		*       TYPE value
		*
		*   Returns
		*   -----------------------
		*
		*       nothing
		*
		*/

		int find(void* value);
		/*
		*
		*   Description
		*   -----------------------
		*
		*       Searches for an element in array.
		*
		*   Takes
		*   -----------------------
		*
		*       void* value
		*
		*			-	magnitude of value to search for
		*
		*   Returns
		*   -----------------------
		*
		*       int
		*
		*			-	position in array (-1 if not found).
		*
		*/
	/*
	*************************************************************************************/
}; //class IndexedArray

#define SORTED_INDEXED_ARRAY_CPP
#include "SortedIndexedArray.cpp"
#undef SORTED_INDEXED_ARRAY_CPP

#endif